package com.software.fanfan.serveice.impl;

import com.software.fanfan.constant.ResultEnum;
import com.software.fanfan.dao.UserDao;
import com.software.fanfan.entity.model.UserModel;
import com.software.fanfan.entity.vo.Result;
import com.software.fanfan.exception.BusinessException;
import com.software.fanfan.repository.UserRepository;
import com.software.fanfan.serveice.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * userService
 *
 * Created by shiyanfei on 2018-01-09.
 */
@Service
public class UserServiceImpl implements UserService{


    @Autowired
    private UserDao userDao;

    @Autowired
    private UserRepository userRepository;

    @Override
    public Result login(String loginId, String password) {

        UserModel user = userDao.getUserByLoginId(loginId,password);
        if(user==null){
            throw new BusinessException(ResultEnum.LOGIN_NOUSER);
        }else{
            return null;
        }

    }
}
